home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / bc-1_02.lha / bc-1.02 / Makefile < prev    next >
Makefile  |  1992-03-04  |  5KB  |  191 lines

  1. #
  2. # A makefile for bc.  This is part of the bc/sbc distribution.
  3. #
  4. #
  5. #  Make sure these have the correct directories for your machine.
  6. #
  7. #  LIBDIR and BINDIR are where bc and libmath.b will be put.
  8. #
  9. PREFIX = /usr/local
  10. LIBDIR = $(PREFIX)/lib
  11. BINDIR = $(PREFIX)/bin
  12. MANDIR = $(PREFIX)/man/man1
  13. #
  14. #  INCLUDE is the directory from where header files are included.
  15. #
  16. INCLUDE = /usr/include
  17. #
  18. # This is the name of the library file, if needed.  This definition should
  19. # not be deleted.
  20. #
  21. LIBFILE = $(LIBDIR)/libmath.b
  22. #
  23. # Programs definitions for use by make.
  24. #
  25. SHELL = /bin/sh
  26. YACC = yacc
  27. #YACC = bison -y
  28. LEX = flex -I8
  29. #LEX = lex
  30. CC = cc
  31. UUENCODE = uue
  32. MAKE = make
  33. #
  34. #  The following are the standard definitions.  For MINIX PC, you need to
  35. #  comment these out and select one of the MINIX PC definition sets.
  36. #  Other configuration defines are generated automatically.  See the 
  37. #  README file for more details.
  38. #
  39. O=o
  40. CFLAGS = -O -D_POSIX_SOURCE
  41. LDFLAGS = 
  42. #
  43. # For the PC version of MINIX (K&R compiler), use the following lines.
  44. #O=s
  45. #CFLAGS = -O -D_POSIX_SOURCE
  46. #LDFLAGS = -i
  47. #
  48. # For the PC version of MINIX (ANSI compiler), use the following lines:
  49. #O=o
  50. #CFLAGS = -m -D_POSIX_SOURCE
  51. #LDFLAGS = -i
  52. #
  53. #
  54. OFILES = scan.$O util.$O main.$O number.$O storage.$O load.$O execute.$O 
  55. #
  56. DISTFILES = COPYING Makefile Install bc.y bcdefs.h const.h version.h \
  57.             execute.c global.c global.h load.c main.c number.c storage.c \
  58.         number.h proto.h scan.l util.c vfprintf.c README bc.1 sbc.y \
  59.         fix_math.h math.h libmath.b configure ChangeLog 
  60. #
  61. SUBDIRS = Examples Test
  62. #
  63. EXTRAFILES = bc.c.dist scan.c.dist y.tab.h.dist
  64. #
  65.  
  66.  
  67. all: bc
  68. bc: $& config.h bc.$O $(OFILES) global.$O
  69.     $(CC) -o bc $(LDFLAGS) bc.$O $(OFILES) global.$O
  70.  
  71. sbc: sbc.$O $(OFILES) global.$O
  72.     $(CC) -o sbc $(LDFLAGS) sbc.$O $(OFILES) global.$O
  73.  
  74. config.h:
  75.     ./configure $(INCLUDE) $(LIBFILE) $(CC)
  76.  
  77. math.h: libmath.b
  78.     $(MAKE) fbc
  79.     ./fbc -c libmath.b </dev/null >math.h
  80.     ./fix_math.h
  81.     rm -f ./fbc
  82.  
  83. fbc: $(OFILES) bc.$O
  84.     echo \"\" > math.h
  85.     $(CC) -c $(CFLAGS) global.c
  86.     $(CC) -o fbc $(LDFLAGS) bc.$O $(OFILES) global.$O
  87.  
  88. install : bc libmath.b config.h
  89.     rm -f $(BINDIR)/bc
  90.     cp bc $(BINDIR)
  91.     chmod 555 $(BINDIR)/bc
  92.     if grep -s BC_MATH_FILE config.h; then rm -f $(LIBDIR)/libmath.b; \
  93.     cp libmath.b $(LIBDIR); chmod 444 $(LIBDIR)/libmath.b; else true; fi
  94.     cp bc.1 $(MANDIR)
  95.  
  96. dist: $(EXTRAFILES)
  97.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  98.     ; rm -rf $$OF \
  99.     ; mkdir $$OF \
  100.     ; cd $$OF \
  101.     ; for file in $(DISTFILES) $(EXTRAFILES); do ln ../$$file; done \
  102.     ; mkdir $(SUBDIRS) \
  103.     ; for dir in $(SUBDIRS); do cp ../$$dir/* $$dir; done \
  104.     ; cd .. \
  105.     ; tar cf $$OF.tar $$OF \
  106.     ; compress $$OF.tar \
  107.     ; rm -rf $$OF
  108.  
  109. shars: dist
  110.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  111.     ; $(UUENCODE) $$OF.tar.Z - > $$OF.uue \
  112.     ; split -775 $$OF.uue $$OF-u. \
  113.     ; for file in $$OF-u.a?; do shar $$file > $$file.sh; done
  114.  
  115. minixdist: $(EXTRAFILES)
  116.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  117.     ; rm -rf $$OF \
  118.     ; mkdir $$OF \
  119.     ; cd $$OF \
  120.     ; for file in $(DISTFILES) $(EXTRAFILES); do ln ../$$file; done \
  121.     ; cd .. \
  122.     ; tar cf $$OF.tar $$OF \
  123.     ; compress -b13 $$OF.tar \
  124.     ; rm -rf $$OF
  125.  
  126. minixshars: minixdist
  127.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  128.     ; $(UUENCODE) $$OF.tar.Z - > $$OF.uue \
  129.     ; split -775 $$OF.uue $$OF-u. \
  130.     ; for file in $$OF-u.a?; do shar $$file > $$file.sh; done
  131.  
  132. csrshars: $(EXTRAFILES)
  133.     findsrc -dy $(DISTFILES) $(EXTRAFILES) $(SUBDIRS) | \
  134.     makekit -npart -oMANIFEST
  135.  
  136. bc.c.dist: bc.c
  137.     cp bc.c bc.c.dist
  138.  
  139. scan.c.dist: scan.c
  140.     cp scan.c scan.c.dist
  141.  
  142. y.tab.h.dist: y.tab.h
  143.     cp y.tab.h y.tab.h.dist
  144.  
  145. extra:  $(EXTRAFILES)
  146.  
  147. # assumes that the extra files exist!
  148. derived:
  149.     cp bc.c.dist bc.c
  150.     cp scan.c.dist scan.c
  151.     cp y.tab.h.dist y.tab.h
  152.  
  153. clean:
  154.     rm -f *.$O core ERRS *~ *.bak *.Z 
  155.  
  156. distclean: clean
  157.     rm -f scan.c y.tab.h bc.c sbc.c bc sbc bc-dist* config.h  bc-*.* \
  158.     part?? MANIFEST*
  159.  
  160. realclean: distclean
  161.     rm -rf *.dist
  162.  
  163. scan.c: scan.l
  164.     $(LEX) scan.l
  165.     mv lex.yy.c scan.c
  166.  
  167. y.tab.h bc.c: bc.y
  168.     @echo "expect 1 shift/reduce conflict"
  169.     $(YACC) -d bc.y
  170.     mv y.tab.c bc.c
  171.  
  172. sbc.c: sbc.y
  173.     $(YACC) -d sbc.y
  174.     mv y.tab.c sbc.c
  175.  
  176. global.$O: bcdefs.h global.h math.h
  177. bc.$O:    bcdefs.h global.h 
  178. execute.$O: bcdefs.h global.h
  179. load.$O: bcdefs.h global.h 
  180. main.$O: bcdefs.h global.h version.h
  181. number.$O: bcdefs.h Makefile
  182. sbc.$O: bcdefs.h global.h 
  183. scan.$O: y.tab.h bcdefs.h global.h
  184. storage.$O: bcdefs.h global.h
  185. util.$O: bcdefs.h global.h version.h
  186.  
  187. bcdefs.h: number.h const.h config.h
  188.     touch bcdefs.h
  189.